package com.yupi.yuojcodesandbox.judge.codesandbox;

import com.yupi.yuojcodesandbox.judge.codesandbox.model.ExecuteCodeRequest;
import com.yupi.yuojcodesandbox.judge.codesandbox.model.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

/**
 * @Author:Dong
 * @Date: 2024/4/20  11:54
 * @Version 1.0
 */
@Slf4j
public class CodeSandboxProxy implements CodeSandbox {
    private final CodeSandbox codeSandbox;

    public CodeSandboxProxy(CodeSandbox codeSandbox) {
        this.codeSandbox = codeSandbox;
    }

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) throws IOException {
        log.info("请求消息" + executeCodeRequest.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandbox.executeCode(executeCodeRequest);
        log.info("响应消息" + executeCodeResponse.toString());
        return executeCodeResponse;

    }
}
